package com.jingtai.shop.webfacade.bo.user;

import com.jingtai.common.webfacade.BaseBO;
import com.jingtai.common.webfacade.error.CommonException;
import com.jingtai.common.webfacade.error.ErrorEnum;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.Size;

/**
 * 忘记密码入参
 */
@Data
public class UserForgetPwdBO extends BaseBO {

    /**
     * 手机号码
     */
    private String phone;

    /**
     * 密码
     */
    @Size(min = 6, max = 12, message = "密码长度要求6到12之间。")
    private String password;


    /**
     * 验证码
     */
    private String smsCode;

    @Override
    public void validate() {
        super.validate();
        if (StringUtils.isEmpty(password) || StringUtils.isEmpty(phone) || StringUtils.isEmpty(smsCode)){
            throw new CommonException(ErrorEnum.REQUIRED_PARAM_EMPTY);
        }
    }
}
